package kr.couponplay.android.activity;

import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TabHost;

public class TitleBarHelper {
	private static FrameLayout frameLayout;
	private static TabHost tabHost;
	
	public static void setFrameLayout(FrameLayout frameLayout) {
		TitleBarHelper.frameLayout = frameLayout;
	}	
	
	public static void addTitleLayout(LinearLayout titleLayout) {
		if (frameLayout != null) {
			frameLayout.addView(titleLayout);
		}
	}
	
	public static void setVisibable(View titleView) {
		for (int i=0; i<frameLayout.getChildCount(); i++) {
			View view = frameLayout.getChildAt(i);
			if (view == titleView) {
				view.setVisibility(View.VISIBLE);
			} else {
				view.setVisibility(View.GONE);
			}
		}
	}
	
	public static TabHost getTabHost() {
		return tabHost;
	}

	public static void setTabHost(TabHost tabHost) {
		TitleBarHelper.tabHost = tabHost;
	}

	public static void clear() {
		frameLayout.removeAllViews();
		frameLayout = null;
	}
}
